import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:yt_devops/components/app_bar/app_bar_widget.dart';
import 'package:yt_devops/components/yt_button.dart';
import 'package:yt_devops/pages/site/site_setting/site_setting_base_info/widgets/item_widget.dart';
import 'package:yt_devops/resources/str_res_keys.dart';
import 'package:yt_devops/styles/styles.dart';
import 'scan_fail_mannual_access_controller.dart';

class ScanFailMannualAccessPage extends GetView<ScanFailMannualAccessController> {
    const ScanFailMannualAccessPage({Key? key}) : super(key: key);

    @override
    Widget build(BuildContext context) {
        final BrnFormItemConfig theme = BrnFormItemConfig(
            formPadding: EdgeInsets.zero);
    return GestureDetector(
        onTap: () => FocusScope.of(context).unfocus(),
        child: Scaffold(
            resizeToAvoidBottomInset: false,
            appBar: AppBarWidget.withRightActions(ResKey.bindingDevice.tr),
            body: GetBuilder<ScanFailMannualAccessController>(
                builder: (controller) => Container(
                    color: Colour.backgroundColor,
                    child: Column(
                        children: [
                            Expanded(
                                child: ListView(
                                    padding: EdgeInsets.zero,
                                    children: [
                                        Container(
                                            height: 51,
                                            margin: EdgeInsets.only(top: 10),
                                            // color: Colors.red,
                                            // alignment: Alignment.center,
                                            // padding: const EdgeInsets.only(left: 16,right: 16,top: 20),
                                            child:   ItemWidget(
                                                ResKey.deviceSn.tr,
                                                controller.snTextController,
                                                inputTextFont: 16,
                                                inputTextColor: Colour.mainTextColor,
                                                titleColor: Colour.mainTextColor,
                                                isCanEdit: true,
                                                textChangeCallBack: (str){
                                                    controller.update();

                                                }, isShowDivider:false
                                            ),
                                        ),
                                    ]),
                            ),
                            Align(
                                alignment: Alignment.bottomCenter,
                                child: Container(
                                    color: Colour.white,
                                    margin: EdgeInsets.only(top: 10.h),
                                    padding: EdgeInsets.symmetric(
                                        horizontal: 16.w, vertical: 16.h),
                                    child: SafeArea(
                                        child: YtButton(
                                            enabled: controller.snTextController.text.isNotEmpty,
                                            color: controller.snTextController.text.isNotEmpty
                                                ? Colour.primaryColor
                                                : Theme.of(context).primaryColorLight,
                                            text: ResKey.siteDeviceAccessNext.tr,
                                            onPress: () => controller.gotoNext(),
                                        ),
                                    ),
                                ),
                            ),
                        ],
                    ),
                ),
            ),
        ));
    }
}
